<?php

namespace app\common\validate;

use think\Validate;

class Certification extends Validate
{
    protected $rule = [
        'card_no' => 'require|checkCardNo',
        'proposer' => 'require',
        'member_id' => 'require',
        'source' => 'require',
        'id_card_in_hand' => 'require',
        'id_card_front' => 'require',
        'id_card_verso' => 'require',
    ];

    protected $message = [
        'card_no.require' =>  400070,
        'card_no.checkCardNo' =>  400064,
        //'proposer.unique' =>  400098,
        'proposer.require' =>  400070,
        'member_id.require' =>  400095,
        'source.require' =>  400078,
        'id_card_in_hand.require' =>  400070,
        'id_card_front.require' =>  400070,
        'id_card_verso.require' =>  400070,
    ];

    protected $scene = [
        'add'  =>  ['card_no','proposer', 'member_id', 'source'],
    ];

    // 自定义验证规则
    protected function checkCardNo($value)
    {
        return checkCardNo($value);
    }
}